package com.explore.demo.service.impl;

import com.explore.demo.VO.MailInfoVO;
import com.explore.demo.common.ServerResponse;
import com.explore.demo.service.MailSendService;
import com.explore.demo.utils.MailUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 邮件服务的实现类
 * @author gaolainan
 */
@Service
public class MailSenderServiceImpl implements MailSendService
{

    @Resource
    private MailUtils mailUtils;

    @Override
    public ServerResponse sendSimpleMail(MailInfoVO mailInfoVO)
    {
        if (mailInfoVO == null){
            return ServerResponse.createBySuccessMessage("传入的参数为空",2000,null);
        }
        return mailUtils.sendSimpleMail(mailInfoVO)?
               ServerResponse.createBySuccessMessage("发送成功",200, null):
               ServerResponse.createBySuccessMessage("发送失败",2000, null);
    }
}
